﻿CREATE TABLE [account].[AccountMapping] (
    [AccountMappingId]        INT                 IDENTITY (1, 1) NOT NULL,
    [AccountMappingPath]      [sys].[hierarchyid] NOT NULL,
    [AccountMappingLevel]     AS                  ([AccountMappingPath].[GetLevel]()) PERSISTED,
    [AccountHierarchyId]      SMALLINT            NOT NULL,
    [AccountId]               SMALLINT            NOT NULL,
    [AccountMappingStartDate] DATE                NOT NULL,
    [AccountMappingEndDate]   DATE                NULL,
    PRIMARY KEY CLUSTERED ([AccountMappingId] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF)
);

